<?php

// @formatter:off
/**
 * @file credits.php
 * @author Alejandro Dario Simi
 * @date $Date: 2014-05-04 01:33:52 +0000 (Sun, 04 May 2014) $
 *
 * $Id: credits.php 111 2014-05-04 01:33:52Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/trunk/frontview/actions/content/credits.php $
 */
// @formatter:on

class ActionControllerContentCredits extends WCActionController {
	//
	// Magic methods.
	public function __construct() {
		parent::__construct();

		$this->_cacheTime = WCViewManager::CacheTimeMax;
	}
	//
	// Public methods.
	public function check() {
		$check = parent::check();

		if($check == WC_HTTPERROR_OK) {
			global $wcProfile;
			global $wcDefaults;

			if(!$wcProfile->allowedTo(WC_PERM_SPECIAL_CREDIT)) {
				global $errno;
				global $error;

				$check = WC_HTTPERROR_FORBIDDEN;
				$errno = $check;
				$error = "You're not allowed to view credits";
			}
			if($check == WC_HTTPERROR_OK && $wcDefaults["no-credits"]) {
				global $errno;
				global $error;

				$check = WC_HTTPERROR_NOT_FOUND;
				//$errno = $check;
				//$error = "Invalid comic";
			}
		}

		return $check;
	}
	//
	// Protected methods.
	protected function subRun() {
		$ok = true;

		return $ok;
	}
}
